package com.mmd.base.enums;

import com.mmd.core.enums.ResultEnum;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;

public enum CacheKey implements CacheKeyService {
    /*用户信息*/
    USER_INFO("user-info-"),
    //商家信息
    MER_INFO("mer-info-"),
    //数据号信息
    STORE_SET("store-set-"),
    //服务消息
    SERVE_MESSAGE("serve:{userId}:"),
    //服务通知
    SERVE_INFORM("serve-infrom:{userId}:"),
    //系统通知
    USER_MESSAGE("user-msg:{userId}:"),
    //动态商品信息
    DYNAMIC_COM("dynamic-commdity-"),
    /*用户关注的人员*/
    ATTENTION_IDS("user-attention-ids-"),
    /*用户的收藏*/
    COLLECT_ARTICLE_IDS("user-collect-article-ids-"),
    /*用户收藏的店铺*/
    COLLECT_MERCHANT_IDS("user-collect-merchant-ids-"),
    /*用户收藏的商品*/
    COLLECT_GOODS_IDS("user-collect-goods-ids-"),
    /*用户的点赞*/
    PRAISE_ARTICLE_IDS("user-praise-ids-"),
    /*用户的点赞*/
    PRAISE_ARTICLE_COMMENT_IDS("user-praise-comment-ids-"),
    /*用户的黑名单*/
    BLACK_LIST_IDS("black-list-ids-"),
    /*机构账号登录*/
    STORE_LOGIN("store-login-"),
    /*用户的黑名单*/
    STORE_INFO("store-info-");

    private String key;

    CacheKey(String key) {
        this.key = key;
    }

    public String getKey(String suffix) {
        Assert.isTrue(!StringUtils.isEmpty(suffix), ResultEnum.ERROR_SUFFIX.getMessage());
        return this.key + suffix;
    }
}
